package com.ljx.itbbs.server.mall.service.adapter;

import com.ljx.itbbs.common.utils.SnowFlakeUtil;
import com.ljx.itbbs.server.mall.domain.entity.OrderEntity;
import com.ljx.itbbs.server.mall.domain.enums.OrderTypeEnum;
import com.ljx.itbbs.server.mall.domain.enums.PaymentStatusEnum;
import com.ljx.itbbs.server.mall.domain.vo.req.OrderSaveReq;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-03-29  17:32
 */
public class OrderAdapter {
    public static OrderEntity buildOrderSave(OrderSaveReq req, Long userId, String objId, String desc) {
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setId(SnowFlakeUtil.nextId());
        orderEntity.setUserId(userId);
        orderEntity.setObjId(objId);
        orderEntity.setMoney(req.getMoney());
        orderEntity.setType(req.getType());
        orderEntity.setDesc(desc);
        orderEntity.setNumber(req.getNumber());
        orderEntity.setPaymentStatus(PaymentStatusEnum.DEFAULT.getType());
        return orderEntity;
    }
}
